package weekMatch.one_343;

public class LeeCode_01 {
    public static void main(String[] args) {

    }
    private static int isWinner(int[] player1, int[] player2) {
        int s1 = 0, s2 = 0;
        boolean f1 = false, f2 = false;
        for (int i = 0; i < player1.length; i++) {
            if (i == 0){
                s1 += player1[0];
                s2 += player2[0];
            } else if (i == 1){
                s1 += player1[0] == 10 ? player1[1] * 2 : player1[1];
                s2 += player2[0] == 10 ? player2[1] * 2 : player2[1];
            }else {
                s1 += player1[i - 1] == 10 || player1[i - 2] == 10 ? player1[i] * 2 : player1[i];
                s2 += player2[i - 1] == 10 || player2[i - 2] == 10 ? player2[i] * 2 : player2[i];
            }
        }
        if (s1 == s2)
            return 0;
        return s1 > s2 ? 1 : 2;
    }
}
